/**
 * SPDX-FileCopyrightText: 2023-2025 Sangfor Technologies Inc.
 * SPDX-License-Identifier: Mulan PSL v2
 */
import store from 'src/vuex/store';
import {dateFtt} from "src/util/time";

let userID = store.state.userId;
let cookie = document.cookie

export const POINT_URL = '/aip-operation-data/v1/user-action'
const commonParams = {
    cookie,
    username: userID, // 用户名
    action_source: "browser", // 行为来源 browser| sdk | cli
}
const ACTION_MAP = {
    'open_notebook': {
        action: 'open_notebook',
        action_module: 'project_manage'
    },
    'open_vscode': {
        action: 'open_vscode',
        action_module: 'project_manage'
    },
    'save_image': {
        action: 'save_image',
        action_module: 'project_manage'
    },
    'search_dataset': {
        action: 'search_dataset',
        action_module: 'data_manage'
    },
    'query': {
        action: 'query',
        action_module: 'data_manage'
    },
}


export const burialPointParams = (actionName,id) => {
    const action_time = dateFtt('yyyy-MM-dd hh:mm:ss', new Date())

    return {
        ...commonParams,
        action_time,
        ...ACTION_MAP[actionName],
        ide_id: id,
    }
}

